Click or drag to resize

SipClient Class

SipClient is master class responsible for sending and receiving SIP messages.
Inheritance Hierarchy
SystemObject
  Independentsoft.SipSipClient

Namespace:  Independentsoft.Sip
Assembly:  Independentsoft.Sip (in Independentsoft.Sip.dll) Version: 1.0.700.17927
Syntax
public class SipClient

The SipClient type exposes the following members.

Constructors
  NameDescription
Public methodSipClient
Initializes a new instance of the SipClient class.
Public methodSipClient(String)
Initializes a new instance of the SipClient class using the specified domain.
Public methodSipClient(String, ProtocolType)
Initializes a new instance of the SipClient class using the specified domain and protocol type.
Public methodSipClient(String, Int32)
Initializes a new instance of the SipClient class using the specified domain and port number of SIP server.
Public methodSipClient(String, Int32, ProtocolType)
Initializes a new instance of the SipClient class using the specified domain, port number and protocol type.
Public methodSipClient(String, String, String)
Initializes a new instance of the SipClient class using the specified domain, username and password.
Public methodSipClient(String, ProtocolType, String, String)
Initializes a new instance of the SipClient class using the specified domain, protocol type, username and password.
Public methodSipClient(String, Int32, String, String)
Initializes a new instance of the SipClient class using the specified domain, port number, username and password.
Public methodSipClient(String, Int32, ProtocolType, String, String)
Initializes a new instance of the SipClient class using the specified domain, port number, protocol type, username and password.
Top
Properties
  NameDescription
Public propertyAccept
Gets or sets Accept header field. The Accept header field is used to indicate acceptable message Internet media types in the request body. The header field describes media types using the format type/sub-type commonly used in the Internet. If not present, the assumed acceptable request body format is application/sdp. The wildcard "*" can be used to specify all subtypes.
Public propertyAllow
Gets or sets Allow header field. The Allow header field lists the set of methods supported by the client.
Public propertyAuthenticationUsername
Gets or sets authentication user name. If is set then value of this property will be used instead of Username during authentication.
Public propertyContact
Gets or sets Contact header field. The Contact header field is used to convey a URI that identifies the request/response originator.
Public propertyDialogs
Gets array of existing dialogs.
Public propertyDomain
Gets or sets domain, name of IP address of the remote SIP server.
Public propertyLocalIPEndPoint
Gets or sets local IP address and the port number.
Public propertyLogger
Gets or sets logger.
Public propertyMaxForwards
Gets or sets Max-Forwards default header value for all requests.
Public propertyMaxRetryCount
Gets or sets number of attempts during wrong authentication.
Public propertyCode exampleNatAddress
Gets or sets name or IP address of NAT device (for example router).
Public propertyPassword
Gets or sets password.
Public propertyPort
Gets or sets port number of remote SIP server.
Public propertyProtocol
Gets or sets the protocol type of the client.
Public propertyRemoteIPEndPoint
Gets or sets remote IP address and the port number.
Public propertyRport
Gets or sets remote port parameter in the Via header value for all requests. Default value is -1.
Public propertyTcpListenerSocket
Gets or sets tcp listener socket.
Public propertyTcpPermanentSocket
Gets or sets tcp permanent socket.
Public propertyTcpRequestSocket
Gets or sets tcp request socket.
Public propertyTimeout
The number of milliseconds to wait before the request times out. The default is 60000 milliseconds (60 seconds).
Public propertyUdpSocket
Gets or sets udp socket.
Public propertyUsePermanentTcpConnection
Gets or sets tcp connnection as permanent.
Public propertyUserAgent
Gets or sets user agent.
Public propertyUsername
Gets or sets user name.
Top
Methods
  NameDescription
Public methodAcceptRequest(Request)
Sends "OK" response with status code 200.
Public methodAcceptRequest(Request, String)
Sends "OK" response with status code 200 and the specified description text.
Public methodAck(Dialog)
Acknowledges final response of INVITE request.
Public methodAck(RequestResponse)
Acknowledges final response of INVITE request.
Public methodAck(Response)
Acknowledges final response of INVITE request.
Public methodAck(Dialog, SessionDescription)
Acknowledges final response of INVITE request.
Public methodAck(RequestResponse, SessionDescription)
Acknowledges final response of INVITE request.
Public methodAck(Response, SessionDescription)
Acknowledges final response of INVITE request.
Public methodAuthentication
Authentications the specified request.
Public methodBind
Associates a client with a local endpoint.
Public methodBind(IPEndPoint)
Associates a client with a local endpoint.
Public methodBye(Dialog)
Terminates established media session specified with the dialog.
Public methodBye(RequestResponse)
Terminates established media session specified with the requestResponse parameter.
Public methodBye(Response)
Terminates established media session specified with the response parameter.
Public methodCancel
Cancels last pending INVITE attempt.
Public methodCancel(Dialog)
Cancels pending INVITE attempt specified with the early dialog.
Public methodClearDialog
Clears the dialog.
Public methodClearDialogs
Clears the dialogs.
Public methodClearOldResponses
Clears the old responses.
Public methodConnect
Establishes a connection to a remote host.
Public methodDisconnect
Closes the connection and clean up any resources being used.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetDialog(RequestResponse)
Gets existing dialog based on the specified RequestResponse.
Public methodGetDialog(Response)
Gets existing dialog based on the specified response.
Public methodGetHashCode (Inherited from Object.)
Public methodGetOptions(String, String)
Gets capabilities of a client or server.
Public methodGetOptions(ContactInfo, ContactInfo)
Gets capabilities of a client or server.
Public methodGetOptions(String, String, String)
Gets capabilities of a client or server.
Public methodGetOptions(ContactInfo, ContactInfo, Contact)
Gets capabilities of a client or server.
Public methodGetRegisteredContacts
Returns array of all existing registered contacts.
Public methodGetType (Inherited from Object.)
Public methodInvite(Dialog, SessionDescription)
Changes characteristics of the existing session.
Public methodInvite(Dialog, String, String)
Changes characteristics of the existing session.
Public methodInvite(String, String, String, SessionDescription)
Invites another client to media session.
Public methodInvite(ContactInfo, ContactInfo, Contact, SessionDescription)
Invites another client to media session.
Public methodInvite(String, String, String, String, String)
Invites another client to media session.
Public methodInvite(ContactInfo, ContactInfo, Contact, String, String)
Invites another client to media session.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodModifyEventState(String, String, String, Int32, PresenceDescription)
Updates existing event state.
Public methodModifyEventState(ContactInfo, String, String, Int32, PresenceDescription)
Updates existing event state.
Public methodModifyEventState(String, String, String, Int32, String, String)
Updates existing event state.
Public methodModifyEventState(ContactInfo, String, String, Int32, String, String)
Updates existing event state.
Public methodNotify(Dialog, String)
Sends notification when particular event occurs.
Public methodNotify(Dialog, String, String, String)
Sends notification when particular event occurs.
Public methodPrack
Acknowledges receipt of reliably transported provisional response. Provisional responses is response with status code 1xx.
Public methodPublishEventState(String, String, Int32, PresenceDescription)
Publishes initial event state.
Public methodPublishEventState(ContactInfo, String, Int32, PresenceDescription)
Publishes initial event state.
Public methodPublishEventState(String, String, Int32, String, String)
Publishes initial event state.
Public methodPublishEventState(ContactInfo, String, Int32, String, String)
Publishes initial event state.
Public methodRefer(Dialog, String)
Transfers call to resource specified with the referTo parameter.
Public methodRefer(Dialog, String, String)
Transfers call to resource specified with the referTo parameter.
Public methodRefer(String, String, String, String)
Transfers call to resource specified with the referTo parameter.
Public methodRefer(ContactInfo, ContactInfo, Contact, String)
Transfers call to resource specified with the referTo parameter.
Public methodRefer(String, String, String, String, String)
Transfers call to resource specified with the referTo parameter.
Public methodRefer(ContactInfo, ContactInfo, Contact, String, String)
Transfers call to resource specified with the referTo parameter.
Public methodRefreshEventState(String, String, String, Int32)
Refreshes previously established publications.
Public methodRefreshEventState(ContactInfo, String, String, Int32)
Refreshes previously established publications.
Public methodRefreshSubscription
Refreshes existing subscription with new expiration time.
Public methodRegister(String, ContactInfo)
Registers user to a SIP server. The user informs server of his current contact addresss.
Public methodRegister(String, String)
Registers user to a SIP server. The user informs server of his current contact addresss.
Public methodRegister(String, ContactInfo, Contact)
Registers user to a SIP server. The user informs server of his current contact addresss.
Public methodRegister(String, String, String)
Registers user to a SIP server. The user informs server of his current contact addresss.
Public methodReinvite(Dialog, SessionDescription)
Changes characteristics of the existing session.
Public methodReinvite(Dialog, String, String)
Changes characteristics of the existing session.
Public methodRejectRequest(Request)
Sends "Decline" response with status code 603.
Public methodRejectRequest(Request, String)
Sends "Decline" response with status code 603 and the specified description text.
Public methodRemoveEventState(String, String, String)
Removes event state established by a prior publication.
Public methodRemoveEventState(ContactInfo, String, String)
Removes event state established by a prior publication.
Public methodSendAsynchRequest
Sends request to a client or server and does not wait for the response.
Public methodSendInfo
Sends call signaling information to another client with which it has an established media session.
Public methodSendMessage(Dialog, String)
Sends instant message. The content type of the message is "text/plain".
Public methodSendMessage(String, String, String)
Sends instant message. The content type of the message is "text/plain".
Public methodSendMessage(ContactInfo, ContactInfo, String)
Sends plain text instant message. The content type of the message is "text/plain".
Public methodSendMessage(Dialog, String, String)
Sends instant message with the specified content type.
Public methodSendMessage(String, String, String, String)
Sends instant message with the specified content type.
Public methodSendMessage(ContactInfo, ContactInfo, String, String)
Sends instant message with the specified content type.
Public methodSendRequest
Sends request to a client or server.
Public methodSendResponse(Response)
Sends response to a client or server.
Public methodSendResponse(Response, Request)
Sends response to a client or server.
Public methodSendResponseAccepted(Request)
Sends "Accepted" response with status code 202.
Public methodSendResponseAccepted(Request, String)
Sends "Accepted" response with status code 202 and the specified description text.
Public methodSendResponseBadEvent(Request)
Sends "Bad Event" response with status code 489.
Public methodSendResponseBadEvent(Request, String)
Sends "Bad Event" response with status code 489 and the specified description text.
Public methodSendResponseBadExtension(Request)
Sends "Bad Extension" response with status code 420.
Public methodSendResponseBadExtension(Request, String)
Sends "Bad Extension" response with status code 420 and the specified description text.
Public methodSendResponseBadRequest(Request)
Sends "Bad Request" response with status code 400.
Public methodSendResponseBadRequest(Request, String)
Sends "Bad Request" response with status code 400 and the specified description text.
Public methodSendResponseBusyHere(Request)
Sends "Busy Here" response with status code 486.
Public methodSendResponseBusyHere(Request, String)
Sends "Busy Here" response with status code 486 and the specified description text.
Public methodSendResponseCallIsBeingForwarded(Request)
Sends "Call Is Being Forwarded" response with status code 181.
Public methodSendResponseCallIsBeingForwarded(Request, String)
Sends "Call Is Being Forwarded" response with status code 181 and the specified description text.
Public methodSendResponseCallQueued(Request)
Sends "Call Queued" response with status code 182.
Public methodSendResponseCallQueued(Request, String)
Sends "Call Queued" response with status code 182 and the specified description text.
Public methodSendResponseDecline(Request)
Sends "Decline" response with status code 603. It is same method as RejectRequest(Request).
Public methodSendResponseDecline(Request, String)
Sends "Decline" response with status code 603 and the specified description text. It is same method as RejectRequest(Request).
Public methodSendResponseForbidden(Request)
Sends "Forbidden" response with status code 403.
Public methodSendResponseForbidden(Request, String)
Sends "Forbidden" response with status code 403 and the specified description text.
Public methodSendResponseMethodNotAllowed(Request)
Sends "Method Not Allowed" response with status code 405.
Public methodSendResponseMethodNotAllowed(Request, String)
Sends "Method Not Allowed" response with status code 405 and the specified description text.
Public methodSendResponseNotAcceptable(Request)
Sends "Not Acceptable" response with status code 606.
Public methodSendResponseNotAcceptable(Request, String)
Sends "Not Acceptable" response with status code 606 and the specified description text.
Public methodSendResponseNotAcceptableHere(Request)
Sends "Not Acceptable Here" response with status code 488.
Public methodSendResponseNotAcceptableHere(Request, String)
Sends "Not Acceptable Here" response with status code 488 and the specified description text.
Public methodSendResponseOK(Request)
Sends "OK" response with status code 200. It is same method as AcceptRequest(Request).
Public methodSendResponseOK(Request, String)
Sends "OK" response with status code 200 and the specified description text. It is same method as AcceptRequest(Request).
Public methodSendResponseRequestPending(Request)
Sends "Request Pending" response with status code 491.
Public methodSendResponseRequestPending(Request, String)
Sends "Request Pending" response with status code 491 and the specified description text.
Public methodSendResponseRequestTerminated(Request)
Sends "Request Terminated" response with status code 487.
Public methodSendResponseRequestTerminated(Request, String)
Sends "Request Terminated" response with status code 487 and the specified description text.
Public methodSendResponseRinging(Request)
Sends "Ringing" response with status code 180.
Public methodSendResponseRinging(Request, String)
Sends "Ringing" response with status code 180 and the specified description text.
Public methodSendResponseSessionProgress(Request)
Sends "Session Progress" response with status code 183.
Public methodSendResponseSessionProgress(Request, String)
Sends "Session Progress" response with status code 183 and the specified description text.
Public methodSendResponseTrying(Request)
Sends "Trying" response with status code 100.
Public methodSendResponseTrying(Request, String)
Sends "Trying" response with status code 100 and the specified description text.
Public methodSendResponseUnauthorized(Request)
Sends "Unauthorized" response with status code 401.
Public methodSendResponseUnauthorized(Request, String)
Sends "Unauthorized" response with status code 401 and the specified description text.
Public methodSendResponseUnsupportedMediaType(Request)
Sends "Unsupported Media Type" response with status code 415.
Public methodSendResponseUnsupportedMediaType(Request, String)
Sends "Unsupported Media Type" response with status code 415 and the specified description text.
Public methodSendResponseUnsupportedURIScheme(Request)
Sends "Unsupported URI Scheme" response with status code 416.
Public methodSendResponseUnsupportedURIScheme(Request, String)
Sends "Unsupported URI Scheme" response with status code 416 and the specified description text.
Public methodSubscribe(String, String, String, Int32)
Subscribes in order to receiving notifications about a particular event specified with the event name.
Public methodSubscribe(ContactInfo, ContactInfo, String, Int32)
Subscribes in order to receiving notifications about a particular event specified with the event name.
Public methodSubscribe(String, String, String, String, Int32)
Subscribes in order to receiving notifications about a particular event specified with the event name.
Public methodSubscribe(ContactInfo, ContactInfo, Contact, String, Int32)
Subscribes in order to receiving notifications about a particular event specified with the event name.
Public methodSubscribe(String, String, String, String, String, Int32)
Subscribes in order to receiving notifications about a particular event specified with the event name.
Public methodSubscribe(ContactInfo, ContactInfo, Contact, String, String, Int32)
Subscribes in order to receiving notifications about a particular event specified with the event name.
Public methodToString (Inherited from Object.)
Public methodUnregister(String, ContactInfo)
Cancels user's registration from the server.
Public methodUnregister(String, String)
Cancels user's registration from the server.
Public methodUnregister(String, ContactInfo, Contact)
Cancels user's registration from the server.
Public methodUnregister(String, String, String)
Cancels user's registration from the server.
Public methodUnsubscribe(Dialog)
Terminates existing subscription specified with the dialog.
Public methodUnsubscribe(RequestResponse)
Terminates existing subscription.
Public methodUnsubscribe(Response)
Terminates existing subscription specified with the response.
Public methodUpdate(Dialog, SessionDescription)
Modifies the state of a session without changing the state of the dialog.
Public methodUpdate(Dialog, String, String)
Modifies the state of a session without changing the state of the dialog.
Top
Events
  NameDescription
Public eventReceiveRequest
Occurs when the client receives a Request.
Public eventReceiveResponse
Occurs when the client receives a Response.
Top
Examples
The following code example use SipClient class to connect and register to a SIP server.
using System;
using Independentsoft.Sip;
namespace ConsoleApplication1
{
class Class1
{
private static Logger logger;
private static SipClient client;
public static void Main(string[] args)
{
client = new SipClient("sipdomain.com","Bob","password");
logger = new Logger();
logger.WriteLog += new WriteLogEventHandler(OnWriteLog);
client.Logger = logger;
client.ReceiveRequest += new ReceiveRequestEventHandler(OnReceiveRequest);
client.ReceiveResponse += new ReceiveResponseEventHandler(OnReceiveResponse);
client.Connect();
client.Register("sip:sipdomain.com","sip:Bob@mydomain.com", "sip:Bob@mydomain.com");
Console.WriteLine("Press ENTER to exit.");
Console.Read();
client.Disconnect();
}
private static void OnReceiveRequest(object sender, RequestEventArgs e)
{
//accept any request from server or another sip user agent
client.AcceptRequest(e.Request);
}
private static void OnReceiveResponse(object sender,ResponseEventArgs e)
{
}
private static void OnWriteLog(object sender, WriteLogEventArgs e)
{
Console.Write(e.Log);
}
}
}
[Visual Basic]
Imports System
Imports Independentsoft.Sip
Namespace ConsoleApplication1
Class Class1
Private Shared logger As Logger
Private Shared client As SipClient
Public Shared Sub Main(ByVal args() As String)
client = New SipClient("sipdomain.com", "Bob", "password")
logger = New Logger
AddHandler logger.WriteLog, AddressOf OnWriteLog
client.Logger = logger
AddHandler client.ReceiveRequest, AddressOf OnReceiveRequest
AddHandler client.ReceiveResponse, AddressOf OnReceiveResponse
client.Connect()
client.Register("sip:sipdomain.com", "sip:Bob@mydomain.com", "sip:Bob@mydomain.com")
Console.WriteLine("Press ENTER to exit.")
Console.Read()
client.Disconnect()
End Sub
Private Shared Sub OnReceiveRequest(ByVal sender As Object, ByVal e As RequestEventArgs)
'accept any request from server or another sip user agent
client.AcceptRequest(e.Request)
End Sub
Private Shared Sub OnReceiveResponse(ByVal sender As Object, ByVal e As ResponseEventArgs)
End Sub
Private Shared Sub OnWriteLog(ByVal sender As Object, ByVal e As WriteLogEventArgs)
Console.Write(e.Log)
End Sub
End Class
End Namespace
See Also